import { computed, ref } from "vue";
import { BigDecimal } from "@chulei-ui/utils";

export const useProgress = () => {
  const total = ref<number>(0);
  const current = ref<number>(0);
  const percent = computed(() => {
    return Math.min(BigDecimal.form(current.value)!.divide(total.value).multiply(100).toFixed(2)!.toNumber(), 100);
  });
  return { total, current, percent };
};
